<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.9.0">
    

    

    



    <meta charset="utf-8">
    
    
    <meta name="sogou_site_verification" content="true">
    
    
    
    <title>Lvshen&#39;s Blog | This is My World</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    
    <meta name="theme-color" content="#3F51B5">
    
    
    <meta name="keywords" content>
    <meta name="baidu-site-verification" content="VIVNdSiMZm">
    <meta name="description" content="学如逆水行舟，不进则退">
<meta property="og:type" content="website">
<meta property="og:title" content="Lvshen&#39;s Blog">
<meta property="og:url" content="https://lvshen9.gitee.io/page/7/index.html">
<meta property="og:site_name" content="Lvshen&#39;s Blog">
<meta property="og:description" content="学如逆水行舟，不进则退">
<meta property="og:locale" content="zh-CN">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Lvshen&#39;s Blog">
<meta name="twitter:description" content="学如逆水行舟，不进则退">
    
    <link rel="shortcut icon" href="/img/mylogo.jpg">
    <link rel="stylesheet" href="//unpkg.com/hexo-theme-material-indigo@latest/css/style.css">
    <script>window.lazyScripts=[]</script>

    <!-- custom head -->
    

</head>

<body>
    <div id="loading" class="active"></div>

    <aside id="menu"  >
  <div class="inner flex-row-vertical">
    <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menu-off">
        <i class="icon icon-lg icon-close"></i>
    </a>
    <div class="brand-wrap" style="background-image:url(/img/brand.jpg)">
      <div class="brand">
        <a href="/" class="avatar waves-effect waves-circle waves-light">
          <img src="/img/avatar.jpg">
        </a>
        <hgroup class="introduce">
          <h5 class="nickname">我的技术小房间</h5>
          <a href="mailto:https://lvshen9.github.io" title="https://lvshen9.github.io" class="mail">https://lvshen9.github.io</a>
        </hgroup>
      </div>
    </div>
    <div class="scroll-wrap flex-col">
      <ul class="nav">
        
            <li class="waves-block waves-effect">
              <a href="/"  >
                <i class="icon icon-lg icon-home"></i>
                主页
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/archives"  >
                <i class="icon icon-lg icon-archives"></i>
                Archives
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/tags"  >
                <i class="icon icon-lg icon-tags"></i>
                Tags
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/categories"  >
                <i class="icon icon-lg icon-th-list"></i>
                Categories
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/about"  >
                <i class="icon icon-lg icon-address-book"></i>
                About
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="/collection"  >
                <i class="icon icon-lg icon-apple"></i>
                Collection
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://lvshen9.github.io/" target="_blank" >
                <i class="icon icon-lg icon-wordpress"></i>
                Blog
              </a>
            </li>
        
            <li class="waves-block waves-effect">
              <a href="https://github.com/lvshen9" target="_blank" >
                <i class="icon icon-lg icon-github-alt"></i>
                GitHub
              </a>
            </li>
        
      </ul>
    </div>
  </div>
</aside>

    <main id="main">
        <header class="top-header" id="header">
    <div class="flex-row">
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light on" id="menu-toggle">
          <i class="icon icon-lg icon-navicon"></i>
        </a>
        <div class="flex-col header-title ellipsis">Lvshen&#39;s Blog</div>
        
        <div class="search-wrap" id="search-wrap">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="back">
                <i class="icon icon-lg icon-chevron-left"></i>
            </a>
            <input type="text" id="key" class="search-input" autocomplete="off" placeholder="输入感兴趣的关键字">
            <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="search">
                <i class="icon icon-lg icon-search"></i>
            </a>
        </div>
        
        
        <a href="javascript:;" class="header-icon waves-effect waves-circle waves-light" id="menuShare">
            <i class="icon icon-lg icon-share-alt"></i>
        </a>
        
    </div>
</header>
<header class="content-header index-header">

    <div class="container fade-scale">
        <h1 class="title">Lvshen&#39;s Blog</h1>
        <h5 class="subtitle">
            
                This is My World
            
        </h5>
    </div>

    


</header>

<div class="container body-wrap">

    <ul class="post-list">
    
        <li class="post-list-item fade">
            <article id="post-深入学习ConcurrentHashMap"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-14 18:22:39" datetime="2017-09-14T10:22:39.000Z"  itemprop="datePublished">2017-09-14</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/14/深入学习ConcurrentHashMap/">深入学习ConcurrentHashMap</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <blockquote>
<p><strong>本文作者：</strong> JoonWhee</p>
<p><strong>本文链接：</strong> <a href="http://opiece.me/2017/04/08/study-concurrentHashMap/" target="_blank" rel="noopener">http://opiece.me/2017/04/08/study-concurrentHashMap/</a></p>
</blockquote>
<p>近期深入学习了ConcurrentHashMap，便整理成一篇博文记录一下，<strong>请注意</strong>：此博文针对的是JDK1.6，因此如果你看到的源码跟我文中的不同，则可能是由于版本不一样。</p>
<h2 id="ConcurrentHashMap的锁分段技术"><a href="#ConcurrentHashMap的锁分段技术" class="headerlink" title="ConcurrentHashMap的锁分段技术"></a>ConcurrentHashMap的锁分段技术</h2><p>HashTable容器在竞争激烈的并发环境下表现出效率低下的原因，是因为所有访问HashTable的线程必须竞争同一把锁。如果容器里有多把锁，每一把锁用于锁容器的其中一部分数据，那么当多线程访问容器里不同数据段的数据时，线程间就不会存在锁竞争，从而可以有效的提高并发访问效率，这就是ConcurrentHashMap所使用的锁分段技术。首先将数据分成一段一段的存储，然后给每一段数据配一把锁，当一个线程占用锁访问其中一个段数据的时候，其他段的数据也能被其他线程访问。</p>
<h2 id="ConcurrentHashMap的结构"><a href="#ConcurrentHashMap的结构" class="headerlink" title="ConcurrentHashMap的结构"></a>ConcurrentHashMap的结构</h2><p>我们通过ConcurrentHashMap的类图来分析ConcurrentHashMap的结构。</p>
    

        <a href="/2017/09/14/深入学习ConcurrentHashMap/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ConcurrentHashMap/">ConcurrentHashMap</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/map/">map</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-解析ConcurrentHashMapp"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-13 21:20:10" datetime="2017-09-13T13:20:10.000Z"  itemprop="datePublished">2017-09-13</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/13/解析ConcurrentHashMapp/">解析ConcurrentHashMapp</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <p>在多线程情况下，我们可能会使用<code>Hashtable</code> 或者<code>Collections.synchronizedMap(hashMap)</code>，这两种方式基本都是对整个 hash 表结构做锁定操作的，这样在锁表的期间，别的线程就需要等待了，无疑性能不高。</p>
<p>那么怎样解决这个问题呢，这样就需要引入ConcurrentHashMap了。</p>
<h4 id="ConcurrentHashMap结构解析"><a href="#ConcurrentHashMap结构解析" class="headerlink" title="ConcurrentHashMap结构解析"></a>ConcurrentHashMap结构解析</h4><p>ConcurrentHashMap也是由数组和链表组成，其实在ConcurrentHashMap 的成员变量中，包含了一个 Segment 的数组（<code>final Segment&lt;K,V&gt;[] segments;</code>），而 Segment 是 ConcurrentHashMap 的内部类，然后在 Segment 这个类中，包含了一个 HashEntry 的数组（<code>transient volatile HashEntry&lt;K,V&gt;[] table;</code>）。而 HashEntry 也是 ConcurrentHashMap 的内部类。HashEntry 中，包含了 key 和 value 以及 next 指针（类似于 HashMap 中 Entry），所以 HashEntry 可以构成一个链表。</p>
<blockquote>
<p>ConcurrentHashMap 数据结构为一个 Segment 数组，每个Segment 数组存入的是HashEntry 键值对，和链表指针。</p>
</blockquote>
    

        <a href="/2017/09/13/解析ConcurrentHashMapp/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/ConcurrentHashMap/">ConcurrentHashMap</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/map/">map</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-什么是REST，什么是RESTful"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-12 15:32:31" datetime="2017-09-12T07:32:31.000Z"  itemprop="datePublished">2017-09-12</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/12/什么是REST，什么是RESTful/">什么是REST，什么是RESTful</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <p>面试被问到什么是REST，什么是RESTful风格。一下懵逼，以前只对RESTful稍有了解，对REST没有多大的概念。于是查查有关方面的知识。</p>
<p>REST – REpresentational State Transfer 直接翻译：表现层状态转移(其实就是资源在网络中以某种表现形式进行状态转移)。这个词太术语化。用通俗易懂的话来说，<strong>URL定位资源，用HTTP动词（GET,POST,DELETE,PUT）描述操作。</strong></p>
<h4 id="那么，到底什么是REST"><a href="#那么，到底什么是REST" class="headerlink" title="那么，到底什么是REST"></a>那么，到底什么是REST</h4><p>REST描述的是在网络中client和server的一种交互形式；REST本身不实用，实用的是如何设计 RESTful API（REST风格的网络接口）。</p>
<p>Server提供的RESTful API中，URL中只使用名词来指定资源，原则上不使用动词。“资源”是REST架构或者说整个网络处理的核心。比如：</p>
<p>lvshen9.github.com/v1/mybook：获取我的book(地址是我瞎写的)</p>
<p>lvshen9.github.com/v1/myfrends：获取我的好友列表</p>
<p>…</p>
    

        <a href="/2017/09/12/什么是REST，什么是RESTful/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/WebService/">WebService</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/restful/">restful</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-RESTful-架构风格概述"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-11 20:35:33" datetime="2017-09-11T12:35:33.000Z"  itemprop="datePublished">2017-09-11</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/11/RESTful-架构风格概述/">RESTful 架构风格概述</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <blockquote>
<p>本文转载于<a href="http://blog.igevin.info/" target="_blank" rel="noopener">Gevin’s Blog</a><br><a href="http://blog.igevin.info/posts/restful-architecture-in-general/" target="_blank" rel="noopener">原文地址</a></p>
</blockquote>
<p>在移动互联网的大潮下，随着docker等技术的兴起，『微服务』的概念也越来越被大家接受并应用于实践，日益增多的web service逐渐统一于RESTful 架构风格，如果开发者对RESTful 架构风格不甚了解，则开发出的所谓RESTful API总会貌合神离，不够规范。</p>
<p>本文是我对RESTful 架构风格的一些理解，和大家分享一下，如果有问题，欢迎讨论。</p>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://upload-images.jianshu.io/upload_images/4041-41b9f1dd66be83b5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" alt="Restful Style" title>
                </div>
                <div class="image-caption">Restful Style</div>
            </figure>
    

        <a href="/2017/09/11/RESTful-架构风格概述/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/WebService/">WebService</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/restful/">restful</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-Why-We-Need-DI"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-09 22:01:43" datetime="2017-09-09T14:01:43.000Z"  itemprop="datePublished">2017-09-09</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/09/Why-We-Need-DI/">Why We Need DI ?</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <p>依赖注入（Dependency Injection）是用于实现控制反转（Inversion of Control）的最常见的方式之一。本文主要介绍依赖注入原理和常见的实现方式。</p>
<h4 id="我们为什么需要依赖注入"><a href="#我们为什么需要依赖注入" class="headerlink" title="我们为什么需要依赖注入"></a>我们为什么需要依赖注入</h4><p>控制反转用于解耦，解的究竟是谁和谁的耦？这是我在最初了解依赖注入时候产生的第一个问题。</p>
<p>Martin Flower在解释依赖注入时，用了一段简短的代码解释了这个问题。</p>
    

        <a href="/2017/09/09/Why-We-Need-DI/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/DI/">DI</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Spring/">Spring</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-排序算法"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-09 10:58:42" datetime="2017-09-09T02:58:42.000Z"  itemprop="datePublished">2017-09-09</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/09/排序算法/">排序算法</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <p><code>Java</code>中有对于排序封装的方法，<code>Arrays.sort()</code>大家肯定不陌生。但对于算法的原理可能有人不知道。</p>
<p>下面我们讲解一下选择排序与冒泡排序实现原理：</p>
<h4 id="选择排序"><a href="#选择排序" class="headerlink" title="选择排序"></a>选择排序</h4><figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://ovdkcl9ae.bkt.clouddn.com/17-9-9/29644004.jpg" alt="选择排序图解" title>
                </div>
                <div class="image-caption">选择排序图解</div>
            </figure>
<p>如图，选择排序的原理就是数组中的一个元素分别和其他所有元素两两比较，把最大值或者最小值赋给这个元素，从而实现排序。</p>
    

        <a href="/2017/09/09/排序算法/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/冒泡/">冒泡</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/算法/">算法</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-What-s-Ajax"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-08 20:06:00" datetime="2017-09-08T12:06:00.000Z"  itemprop="datePublished">2017-09-08</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/08/What-s-Ajax/">What&#39;s Ajax ?</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <h4 id="什么是-Ajax"><a href="#什么是-Ajax" class="headerlink" title="什么是 Ajax ?"></a>什么是 Ajax ?</h4><p>曾经有人面试被问到Ajax的全称是什么？不得不说这个问题很无语，开发了这么久，早忘了Ajax的全称了。最近上网逛了逛博客，详细的了解了下Ajax，特来分享一下。</p>
<p>AJAX全称为“Asynchronous JavaScript and XML”（异步JavaScript和XML），是一种创建交互式网页应用的网页开发技术。它使用：</p>
<ul>
<li><p>使用XHTML+CSS来标准化呈现；</p>
</li>
<li><p>使用XML和XSLT进行数据交换及相关操作；</p>
</li>
<li><p>使用XMLHttpRequest对象与Web服务器进行异步数据通信； </p>
</li>
<li><p>使用Javascript操作Document Object Model进行动态显示及交互； </p>
</li>
<li><p>使用JavaScript绑定和处理所有数据。</p>
</li>
</ul>
<p>对于后端开发的我了解它是前端用来和后端异步通信的一种技术。或许有人会问什么是异步？有异步是否意味着有同步？书到用时用时方恨少了吧。下面是一个简洁的比较：</p>
    

        <a href="/2017/09/08/What-s-Ajax/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Web/">Web</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-JVM调优笔记"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-06 16:26:29" datetime="2017-09-06T08:26:29.000Z"  itemprop="datePublished">2017-09-06</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/06/JVM调优笔记/">JVM调优笔记</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <h4 id="内存分代"><a href="#内存分代" class="headerlink" title="内存分代"></a>内存分代</h4><p>不同对象的生命周期不同，所以垃圾回收的方式也会不同，这样做是有助于提高回收的效率</p>
<h5 id="虚拟机内存划分为三个代"><a href="#虚拟机内存划分为三个代" class="headerlink" title="虚拟机内存划分为三个代"></a>虚拟机内存划分为三个代</h5><p><strong>年轻代（Young Generation）、年老代（Old Generation）和持久代（Permanent Generation）</strong></p>
<p>其中<code>年轻代</code>与<code>老年代</code>属于堆内存中，垃圾回收主要针对于这两个代</p>
<p>年轻代有一个Eden区和两个或两个以上的Survivor区，对象先存在Eden区，当Eden区满了后，再存在Survivor区，都满了，说明对象生命周期较长，会存在老年代。</p>
    

        <a href="/2017/09/06/JVM调优笔记/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/堆栈/">堆栈</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-读书笔记：《锋利的jQuery》"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-05 14:25:40" datetime="2017-09-05T06:25:40.000Z"  itemprop="datePublished">2017-09-05</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/05/读书笔记：《锋利的jQuery》/">读书笔记：《锋利的jQuery》</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <blockquote>
<ul>
<li><strong>本文作者：</strong> Cherry</li>
<li><strong>本文链接：</strong> <a href="http://cherryblog.site/sharp-jquery.html" target="_blank" rel="noopener">http://cherryblog.site/sharp-jquery.html</a></li>
</ul>
</blockquote>
<figure class="image-bubble">
                <div class="img-lightbox">
                    <div class="overlay"></div>
                    <img src="http://ovdkcl9ae.bkt.clouddn.com/17-9-5/87469880.jpg" alt="锋利的jQuery" title>
                </div>
                <div class="image-caption">锋利的jQuery</div>
            </figure>
<p>前一段在当当和京东上趁着打折买了十几本编程的书，励志要全部看完！在此立一个 flag，最近也是一直在读书，发现书中更能深入的学到系统的知识。并且如果再能将书中的内容用自己的语言表达出来那就更好了。</p>
<p>书名：《锋利的 jQuery》</p>
<p>简介：这本书适合初学 JS 的童靴看~内容比较基础，我是想看 JQ 源码，然后发现和源码没有半毛钱关系，只是<strong>比较全的介绍 jQuery 的用法</strong>。对没有系统看过 jQuery 用法的，或者 js 的初学者还是有一定帮助的，但是如果你有一定的 js 基础，还是不要浪费时间了。其实 jQuery 好多的用法我们并不清楚，只是将 jQuery 当做方便的元素选择器来使用，其实 jQuery 能做的远比这多得多。</p>
<p>推荐指数：☆☆☆</p>
    

        <a href="/2017/09/05/读书笔记：《锋利的jQuery》/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/jQuery/">jQuery</a></li></ul>

    </div>
    
</article>

        </li>
    
        <li class="post-list-item fade">
            <article id="post-【Java】泛型详解"
  class="article-card article-type-post" itemprop="blogPost">

    <div class="post-meta">
        <time class="post-time" title="2017-09-05 14:08:16" datetime="2017-09-05T06:08:16.000Z"  itemprop="datePublished">2017-09-05</time>

        
	<ul class="article-category-list"><li class="article-category-list-item"><a class="article-category-list-link" href="/categories/技术/">技术</a></li></ul>



    </div>

    


  
    <h3 class="post-title" itemprop="name">
      <a class="post-title-link" href="/2017/09/05/【Java】泛型详解/">【Java】泛型详解</a>
    </h3>
  




    <div class="post-content" id="post-content" itemprop="postContent">

    
        <blockquote>
<p>本文来自 Itimetraveler’s Blog： <a href="http://itimetraveler.github.io/2016/12/27/%E3%80%90Java%E3%80%91%E6%B3%9B%E5%9E%8B%E8%AF%A6%E8%A7%A3/" target="_blank" rel="noopener">【Java】泛型详解</a></p>
</blockquote>
<h4 id="一-为什么需要泛型？"><a href="#一-为什么需要泛型？" class="headerlink" title="一. 为什么需要泛型？"></a>一. 为什么需要泛型？</h4><p>首先，我们看下下面这段简短的代码:</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">GenericTest</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        List list = <span class="keyword">new</span> ArrayList();</span><br><span class="line">        list.add(<span class="string">"qqyumidi"</span>);</span><br><span class="line">        list.add(<span class="string">"corn"</span>);</span><br><span class="line">        list.add(<span class="number">100</span>);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; list.size(); i++) &#123;</span><br><span class="line">            String name = (String) list.get(i);  <span class="comment">// ① 错误</span></span><br><span class="line">            System.out.println(<span class="string">"name:"</span> + name);</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>定义了一个List类型的集合，先向其中加入了两个字符串类型的值，随后加入一个Integer类型的值。这是完全允许的，因为此时list默认的类型为Object类型。在之后的循环中，由于忘记了之前在list中也加入了Integer类型的值或其他编码原因，很容易出现类似于<code>//①</code>中的错误。因为编译阶段正常，而运行时会出现<strong>“java.lang.ClassCastException”异常</strong>。因此，导致此类错误编码过程中不易发现。</p>
    

        <a href="/2017/09/05/【Java】泛型详解/" class="post-more waves-effect waves-button">
            阅读全文…
        </a>
    </div>
    
    <div class="post-footer">
        
	<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Java/">Java</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/泛型/">泛型</a></li></ul>

    </div>
    
</article>

        </li>
    
    </ul>

    
<nav id="page-nav">
    <div class="inner">
    <a class="extend prev" rel="prev" href="/page/6/">上一页</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/5/">5</a><a class="page-number" href="/page/6/">6</a><span class="page-number current">7</span><a class="page-number" href="/page/8/">8</a><a class="page-number" href="/page/9/">9</a><a class="page-number" href="/page/10/">10</a><a class="extend next" rel="next" href="/page/8/">下一页</a>
    </div>
</nav>


</div>

        <footer class="footer">
    <div class="top">
        
<p>
    <span id="busuanzi_container_site_uv" style='display:none'>
        站点总访客数：<span id="busuanzi_value_site_uv"></span>
    </span>
    <span id="busuanzi_container_site_pv" style='display:none'>
        站点总访问量：<span id="busuanzi_value_site_pv"></span>
    </span>
</p>


        <p>
            
            <span>博客内容遵循 <a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">知识共享 署名 - 非商业性 - 相同方式共享 4.0 国际协议</a></span>
        </p>
    </div>
    <div class="bottom">
        <p><span>我的技术小房间 &copy; 2015 - 2020</span>
            <span>
                
                Power by <a href="http://hexo.io/" target="_blank">Hexo</a> Theme <a href="https://github.com/yscoder/hexo-theme-indigo" target="_blank">indigo</a>
            </span>
        </p>
    </div>
</footer>

    </main>
    <div class="mask" id="mask"></div>
<a href="javascript:;" id="gotop" class="waves-effect waves-circle waves-light"><span class="icon icon-lg icon-chevron-up"></span></a>



<div class="global-share" id="globalShare">
    <ul class="reset share-icons">
      <li>
        <a class="weibo share-sns" target="_blank" href="http://service.weibo.com/share/share.php?url=https://lvshen9.gitee.io/page/7/&title=Lvshen's Blog&pic=https://lvshen9.gitee.io/img/avatar.jpg" data-title="微博">
          <i class="icon icon-weibo"></i>
        </a>
      </li>
      <li>
        <a class="weixin share-sns wxFab" href="javascript:;" data-title="微信">
          <i class="icon icon-weixin"></i>
        </a>
      </li>
      <li>
        <a class="qq share-sns" target="_blank" href="http://connect.qq.com/widget/shareqq/index.html?url=https://lvshen9.gitee.io/page/7/&title=Lvshen's Blog&source=学如逆水行舟，不进则退" data-title=" QQ">
          <i class="icon icon-qq"></i>
        </a>
      </li>
      <li>
        <a class="facebook share-sns" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://lvshen9.gitee.io/page/7/" data-title=" Facebook">
          <i class="icon icon-facebook"></i>
        </a>
      </li>
      <li>
        <a class="twitter share-sns" target="_blank" href="https://twitter.com/intent/tweet?text=Lvshen's Blog&url=https://lvshen9.gitee.io/page/7/&via=https://lvshen9.gitee.io" data-title=" Twitter">
          <i class="icon icon-twitter"></i>
        </a>
      </li>
      <li>
        <a class="google share-sns" target="_blank" href="https://plus.google.com/share?url=https://lvshen9.gitee.io/page/7/" data-title=" Google+">
          <i class="icon icon-google-plus"></i>
        </a>
      </li>
    </ul>
 </div>


<div class="page-modal wx-share" id="wxShare">
    <a class="close" href="javascript:;"><i class="icon icon-close"></i></a>
    <p>扫一扫，分享到微信</p>
    <img src="//api.qrserver.com/v1/create-qr-code/?data=https://lvshen9.gitee.io/page/7/" alt="微信分享二维码">
</div>




    <script src="//cdn.bootcss.com/node-waves/0.7.4/waves.min.js"></script>
<script>
var BLOG = { ROOT: '/', SHARE: true, REWARD: false };


</script>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/main.min.js"></script>


<div class="search-panel" id="search-panel">
    <ul class="search-result" id="search-result"></ul>
</div>
<template id="search-tpl">
<li class="item">
    <a href="{path}" class="waves-block waves-effect">
        <div class="title ellipsis" title="{title}">{title}</div>
        <div class="flex-row flex-middle">
            <div class="tags ellipsis">
                {tags}
            </div>
            <time class="flex-col time">{date}</time>
        </div>
    </a>
</li>
</template>

<script src="//unpkg.com/hexo-theme-material-indigo@latest/js/search.min.js" async></script>






<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>



<script>
(function() {
    var OriginTitile = document.title, titleTime;
    document.addEventListener('visibilitychange', function() {
        if (document.hidden) {
            document.title = '死鬼去哪里了！';
            clearTimeout(titleTime);
        } else {
            document.title = '(つェ⊂)咦!又好了!';
            titleTime = setTimeout(function() {
                document.title = OriginTitile;
            },2000);
        }
    });
})();
</script>



</body>
</html>
